package com.medical.patient.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.medical.patient.controller.vo.ReceptionVo;
import com.medical.patient.vo.DiagnosemanagementVo;
import com.medical.patient.vo.DiagnosemanagementparticularsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.medical.common.utils.PageUtils;
import com.medical.common.utils.Query;

import com.medical.patient.dao.PatientMedicalRecordDao;
import com.medical.patient.entity.PatientMedicalRecordEntity;
import com.medical.patient.service.PatientMedicalRecordService;


@Service("patientMedicalRecordService")
public class PatientMedicalRecordServiceImpl extends ServiceImpl<PatientMedicalRecordDao, PatientMedicalRecordEntity> implements PatientMedicalRecordService {

    @Autowired
    private PatientMedicalRecordDao patientMedicalRecordDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<PatientMedicalRecordEntity> page = this.page(
                new Query<PatientMedicalRecordEntity>().getPage(params),
                new QueryWrapper<PatientMedicalRecordEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<PatientMedicalRecordEntity>  getByUserId(String userId) {
        List<PatientMedicalRecordEntity> patientMedicalRecordEntityList =  patientMedicalRecordDao.getByUserId(userId);
        return patientMedicalRecordEntityList;
    }

    @Override
    public List<PatientMedicalRecordEntity> getByDoctorId(String doctorId) {
        List<PatientMedicalRecordEntity> patientMedicalRecordEntityList =  patientMedicalRecordDao.getByDoctorId(doctorId);
        return patientMedicalRecordEntityList;
    }

    @Override
    public List<PatientMedicalRecordEntity> patientMedicalRecordEntityByUserId(String userId) {
        List<PatientMedicalRecordEntity> patientMedicalRecordEntityList = patientMedicalRecordDao.patientMedicalRecordEntityByUserId(userId);
        return patientMedicalRecordEntityList;
    }

    @Override
    public List<PatientMedicalRecordEntity> patientMedicalRecordEntityByDoctorId(Integer doctorId) {
        List<PatientMedicalRecordEntity> patientMedicalRecordEntityList = patientMedicalRecordDao.patientMedicalRecordEntityByDoctorId(doctorId);
        return patientMedicalRecordEntityList;
    }

    @Override
    public Page<ReceptionVo> ReceptionList(ReceptionVo vo,Integer page,Integer size) {
        Page<ReceptionVo> receptionVoPage = new Page<>(page, size);
        return patientMedicalRecordDao.ReceptionList(receptionVoPage,vo);
    }

    @Override
    public PatientMedicalRecordEntity diagnosticReport(Integer recordId) {
        return patientMedicalRecordDao.diagnosticReport(recordId);
    }

    //诊断管理列表
    @Override
    public List<DiagnosemanagementVo> diagnosemanagementList(DiagnosemanagementVo vo, Integer doctorId) {
        List<DiagnosemanagementVo> diagnosemanagementVoList = patientMedicalRecordDao.diagnosemanagementList(vo,doctorId);
        return diagnosemanagementVoList;
    }

    //当天患者详细信息
    @Override
    public List<DiagnosemanagementparticularsVo> diagnosemanagementparticularsList(DiagnosemanagementparticularsVo vo, Integer doctorId, String time) {
        List<DiagnosemanagementparticularsVo> diagnosemanagementparticularsVoList = patientMedicalRecordDao.diagnosemanagementparticularsList(vo,doctorId,time);
        return diagnosemanagementparticularsVoList;
    }

}